<?php

$mysqli = new mysqli("localhost", "root", "", "rss");
if ($mysqli->connect_errno) {
	echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
	die;
}

/*if (!isset($_GET["name"]) || !isset($_GET["url"]))
{
	echo "invalid parameters";
	die;
}*/

$postdata = file_get_contents("php://input");

$record = json_decode($postdata);

$result = array("success" => true);

$statement = $mysqli->prepare("INSERT INTO sources (name, url) VALUES (?, ?)");
$statement->bind_param('ss', $record->name, $record->url);
if (!$statement->execute())
{
	$result = array("success" => false);
}


echo json_encode($result);

?>
